//
//  ImportTextView.m
//  JinFuThree
//
//  Created by 毛韶谦 on 2018/9/4.
//  Copyright © 2018年 毛韶谦. All rights reserved.
//

#import "ImportTextView.h"

@implementation ImportTextView

- (instancetype)init {
    
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(20);
            make.centerY.mas_equalTo(self);
            make.width.mas_equalTo(72);
        }];
        [self.leftTextView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.mas_equalTo(self);
            make.right.mas_equalTo(self.mas_right).offset(-20);
            make.left.mas_equalTo(self.titleLabel.mas_right);
        }];
        _lineImageView = [[UIImageView alloc] init];
        _lineImageView.backgroundColor = ThemeMaoLineColor;
        [self addSubview:_lineImageView];
        [_lineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(20);
            make.right.mas_equalTo(self.mas_right).offset(-20);
            make.bottom.mas_equalTo(self);
            make.height.mas_equalTo(0.5f);
        }];
    }
    return self;
}


- (UILabel *)titleLabel {
    
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.textColor = HexColor(0x333333);
        _titleLabel.font = [UIFont systemFontOfSize:14];
        
        
        [self addSubview:_titleLabel];
    }
    return _titleLabel;
}

- (MSQTextField *)leftTextView {
    
    if (!_leftTextView) {
        _leftTextView = [[MSQTextField alloc] init];
        _leftTextView.placeholder = @"请输入";
        
        NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:_leftTextView.placeholder];
        [placeholder addAttribute:NSForegroundColorAttributeName
                            value:HexColor(0xAAAAAA)
                            range:NSMakeRange(0, _leftTextView.placeholder.length)];
        _leftTextView.attributedPlaceholder = placeholder;
        [_leftTextView setTextAlignment:NSTextAlignmentRight];
        _leftTextView.font = [UIFont systemFontOfSize:14];
        
        [self addSubview:_leftTextView];
    }
    return _leftTextView;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
